package com.android.thuchanh;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class TrenAdapter extends BaseAdapter{

	//KHai báo biến toàn cục Layout để điều kiểm layout của list
	LayoutInflater inflater;
	
	public TrenAdapter(Context mContext){
		//Láy layout của activity chính
		inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return 3;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int positon, View ConvertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder;
		View vi = ConvertView;
		if(vi==null){
			vi = inflater.inflate(R.layout.common_item_timeline, null);
			holder = new ViewHolder();
			holder.img1 = (ImageView) vi.findViewById(R.id.img_1);
			holder.img2 = (ImageView) vi.findViewById(R.id.img_2);
			holder.img3 = (ImageView) vi.findViewById(R.id.img_3);
			holder.img4 = (ImageView) vi.findViewById(R.id.img_4);
			holder.tvTagName = (TextView) vi.findViewById(R.id.t03_tv_tag_name);
			holder.tvTotal = (TextView) vi.findViewById(R.id.t03_tv_total);
			vi.setTag(holder);
		}else {
			holder = (ViewHolder) vi.getTag();
		}
		holder.img1.setImageResource(R.drawable.common_bg_tag_name);
		holder.tvTagName.setText("#Thanh hehe");
		//Trả về View -- là một item của listview
		return vi;
	}
	
	public static class ViewHolder{
		ImageView img1,img2,img3,img4;
		TextView tvTagName,tvTotal;
	}

}
